import { connect } from "react-redux"
import { bindActionCreators } from "redux"
import { useEffect } from "react"
import { actionCreaters as registerActionCreaters } from "./store"
import { actionCreaters as flashActionCreaters } from "../Flash/store"

import Registerform from "./Registerform"
import axios from "../../utils/request"
const Register = (props) => {
    useEffect(() => {
        console.log('registComponet props', props)
    }, []) 

    const handleClick = async (param) => {
        const {data} = await axios.post('/api/getData', {name: 'garvin', age: 33})
        console.log(11111,data)
    }
    return (
        <div>
            <Registerform  {...props} />
            <div>
                {

                }
                <button onClick= {() => handleClick("1234")}>+++</button>  
            </div>
        </div>
    )
}
const mapStateToProps = state => {
    return {
        registerData: state.register
    }
}
const mapDispatchToProps = dispatch => {
    return {
        RegisterFn: bindActionCreators(registerActionCreaters, dispatch),
        flashFn: bindActionCreators(flashActionCreaters, dispatch)
    }
}

export default connect(mapStateToProps, mapDispatchToProps)(Register)